package com.mkb.enums;

import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 * @author meikb
 * @desc
 * @date 2024-03-20 15:36
 */
@Getter
public enum UserColorEnum {
    X_LESS_OR_EQUAL_2("rgba(4, 0, 128, 0.1)", 0.2),
    X_GREATER_2_TO_5("rgba(4, 0, 128, 0.3)", 0.5),
    X_GREATER_5_TO_10("rgba(4, 0, 128, 0.6)", 0.7),
    X_GREATER_10("rgba(4, 0, 128, 1)", 0.9);

    private final String colorCode;
    private final double fillOpacity;

    UserColorEnum(String colorCode, double fillOpacity) {
        this.colorCode = colorCode;
        this.fillOpacity = fillOpacity;
    }

    public String getColorCode() {
        return colorCode;
    }

    public static UserColorEnum getColorByCount(int count) {
        if (count <= 2) {
            return X_LESS_OR_EQUAL_2;
        } else if (count > 2 && count <= 5) {
            return X_GREATER_2_TO_5;
        } else if (count > 5 && count <= 10) {
            return X_GREATER_5_TO_10;
        } else {
            return X_GREATER_10;
        }
    }
}
